var depcase = $("#tabContent > .tab-pane.active").data();
var fromDate;
var toDate;
var depName;
var type, title;
$(function(){
	fromDate = depcase.fromDate;
	toDate= depcase.toDate;
	depName= depcase.depName;
	type = depcase.type;
	title = depcase.title;
	
//alert(fromDate+depName);
	loadMDC();
});

function loadMDC() {
	$('#'+tabId+' .dep-name').html(depName);
	$('#'+tabId+' .dep-type').html(title);
	var tb_s='tb'+new Date().getTime();
	$('#'+tabId+' #content').html('<table class="stripe"  id="'+tb_s+'"'
		 		   +'style="text-align: center;">'
		 		  +'<thead><tr>'
		 		 +'<td width="80px">病案号</td>'
		 		+'<td width="40px">姓名</td>'
		 		+'<td width="100px">入院时间</td>'
		 		+'<td width="80px">出院时间</td>'
		 		+'<td width="80px">入院科室</td>'
		 		+'<td width="80px">出院科室</td>'
		 		+'<td width="70px">总费用(元)</td>'
		 		+'<td width="60px">药费(元)</td>'
		 		+'<td width="60px">主治医师</td>'
		 		+'<td width="60px">主诊组</td>'
		 		+'</tr></thead><tbody id="table"></tbody></table>');
	$.post(contextPath+'/DailyRecord/getChangeDetail.dhc',{
		'fromDate':fromDate,
		'toDate':toDate,
		'depName':depName,
		'type':type
	}).done(function(result){
		//alert(JSON.stringify(result));

 		if(result!=null){
 		  	tdata=result.data;
 		  	var columns=[ 
 		                     { "data": "DR_MR_NO" },
 		                     {"data": "DR_PATIENT_NAME"},
 		                     { "data": "DR_IN_DATE"},
 		                     { "data": "DR_OUT_DATE"},
 		                     { "data": "DR_IN_DEP" },
 		                     { "data": "DR_OUT_DEP" }, 
 		                     { "data": "DR_TOTAL_COST"},
 		                     { "data": "DR_DRUG_COST" },
 		                     { "data": "DR_PROTOMEDICUS" },
 		                     { "data": "DR_GROUP_NAME" },
 		                 ];
 		  	var paramsDataTables={retrieve:true,order:[ [0,'asc'], [2,'asc'] ]};
 			$('#'+tabId+' #'+tb_s).dataTableBasic(columns,tdata,paramsDataTables);
 		}
  
	
	});
}

//function detail(mrNo){
//		window.open($WEB_ROOT_PATH+"/patient/patientCtrl.htm?BLHMI=main&dto.patientId="+mrNo);
//	}
